const mongoose = require('mongoose');
const { cinemas } = require("./data/cinemas.js")
const Schema = mongoose.Schema;
// 创建数据结构\
const cinemasSchema = new Schema({
    id:String,//mongodb 自动生成的 id
    name:String,//影院名称
    address:String,//影院地址
    phone:String,//影院联系方式
    status : Boolean,//是否营业
});
 const cinemasModel =mongoose.model("cinemas",cinemasSchema,"cinemas");
 mongoose.connect("mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/maiwenjie", 
 {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" }
  },
 async () => {
    // 当连接成功后触发
    // 创建学生数据 一个（对象）或多个（数组）
    await cinemasModel.create(cinemas)
    // console.log(122);
})